<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" type="text/css" href="<%=path %>/static/css/css.css?1" />
<link rel="stylesheet" type="text/css" href="<%=path %>/static/jquery-ui/jquery-ui.min.css" />
<script type="text/javascript" src="<%=path %>/static/js/json2.js"></script>
<script type="text/javascript" src="<%=path %>/static/js/jquery.js"></script>
<script type="text/javascript" src="<%=path %>/static/jquery-ui/jquery-ui.min.js"></script>
<script type="text/javascript" src="<%=path %>/static/layer/layer.js"></script>
<script type="text/javascript" src="<%=path %>/static/js/gridview.js?v=1"></script>
<script type="text/javascript" src="<%=path %>/static/js/formview.js?v=1"></script>
<script type="text/javascript" src="<%=path %>/static/js/tool.js"></script>
<script type="text/javascript" src="<%=path %>/static/js/validate.js"></script>
<script type="text/javascript" src="<%=path %>/static/js/echarts.js"></script>
<script type="text/javascript" src="<%=path %>/static/js/loadingDiv.js"></script>
<SCRIPT type="text/javascript">
    $.ajaxSetup({
       async: false
    });
    <!--
	var gridSetting = {
			id:'ActiveViewGrid',
			po:"ActiveView",
			title:'用户列表',
			height:'auto',
			service:"uiServices!listSimple",
			tbId:"ActiveTb",
			hideCheckbox:true,
			pageInfo: {
				records: 12,//auto表示根据容器高度自动判断
				orderby : "id desc"
			},
			oper:{
                isDisplay:false,
            	operName:"",
            	url:"",
            	cssClass:"Operation",
            	width:290
            },
			fields:[
               {
                   name: 'id',
                   descs:"注册时间",
                   align:'center'
               },
               {
                   name: 'regCnt',
                   align:'center',
                   descs:"新增注册用户数"
               }
               ,
               {
                   name: 'cnt',
                   align:'center',
                   descs:"活跃数"
               }
			]
		};
	var grid;
    $(document).ready(function(){
    	grid = new GridView("list",gridSetting,"list");
		grid.init();
		var data = [];
		grid.load({data:data});

		ajustHeight();

    });

    //-->
</SCRIPT>
</head>

<body>

<div class="contrainer">
<div class="rcon2" >
      <table class="search_tb">
         <tr>
            <td>
               <div style="float:left">
                  <input type="text" onclick="WdatePicker()" name="createDateTime" placeholder="日期" />
               </div>
               <div style="float:left;margin-left:8px;">
                  <select id="selSrcPla" name="srcPla" style="width:100px;height:36px;">
                     <option value="">渠道</option>
                     <option value="qf_8">应用宝</option>
                     <option value="qf_13">推啊</option>
                     <option value="qf_14">任务分享</option>
                  </select>
               </div>
               <input type="button" class="searchbtn" value="" id="queryBtn">
            </td>
         </tr>
      </table>
</div>

<div class="rcon2">
   <table class="mtable">
      <tr>
         <th>渠道</th>
         <th>激活数</th>
         <th>注册数</th>
         <th>下载数</th>
         <th>日活跃</th>
      </tr>
      <tr style="text-align:center">
         <td>应用宝</td>
         <td id="jhCnt1"></td>
         <td id="regCnt1"></td>
         <td id="downCnt1"></td>
         <td id="hyCnt1"></td>
      </tr>
      <tr style="text-align:center">
         <td>推啊</td>
         <td id="jhCnt2"></td>
         <td id="regCnt2"></td>
         <td id="downCnt2"></td>
         <td id="hyCnt2"></td>
      </tr>
      <tr style="text-align:center">
         <td>任务分享</td>
         <td id="jhCnt3"></td>
         <td id="regCnt3"></td>
         <td id="downCnt3"></td>
         <td id="hyCnt3"></td>
      </tr>
   </table>
</div>
<div id="list" class="rcon2">
</div>
</div>
<script type="text/javascript" src="<%=path %>/static/js/underscore.js"></script>
<script type='text/javascript' src='<%=path %>/static/My97DatePicker/WdatePicker.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/engine.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/util.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/interface/BaseDwr.js'></script>
<script>
   var createdatetime;

   $(function(){
      loadData();
      $("#queryBtn").click(function(){
         loadData();
      });
   });
   function loadData(){
      createdatetime = $(".search_tb").find(":input[name=createDateTime]:eq(0)").val();

      $.getJSON("<%=path %>/public/common/getBusinessList.htmls",{createdatetime:createdatetime},function(data){
         $("#jhCnt1").text(data.jhCnt1);
         $("#regCnt1").text(data.regCnt1);
         $("#jhCnt2").text(data.jhCnt2);
         $("#regCnt2").text(data.regCnt2);
         $("#jhCnt3").text(data.jhCnt3);
         $("#regCnt3").text(data.regCnt3);

         $("#downCnt1").text(data.downCnt1);
         $("#hyCnt1").text(data.hyCnt1);
         $("#downCnt2").text(data.downCnt2);
         $("#hyCnt2").text(data.hyCnt2);
         $("#downCnt3").text(data.downCnt3);
         $("#hyCnt3").text(data.hyCnt3);
      });

      var data = [];
      /*if(createdatetime!==""){
         data.push({r:"=",name:'id',value:createdatetime});
      }*/
      grid.load({data:data});
   }
   function afterLoad_ActiveTb(){
      $(".rcon2 .mtable tbody tr").each(function(){
         var $date=$(this).find("td[name=id]");
         /*var uhtml="<a href='<%=path %>/public/common/r2.htmls?page=count/business_view&date="+$date.text()+"'>"+$date.text()+"</a>";
         $date.html(uhtml);*/

         var $regCnt=$(this).find("td[name=regCnt]");
         var $cnt=$(this).find("td[name=cnt]");
         var date=createdatetime==""?$date.text():createdatetime;
         $.getJSON("<%=path %>/public/common/getActiveCnt.htmls",{date1:$date.text(),date2:date,SrcPla:$("#selSrcPla").val()},function(data){
            $regCnt.text(data.regCnt);
            $cnt.text(data.acCnt);
         });
      });
   }
</script>
</body>
</html>